package org.goodsl.mdd.validator;

import org.goodsl.mdd.Seg;


/**
 * Created with IntelliJ IDEA.
 * User: Simon Xiao
 * Date: 12-11-12
 * Time: 下午3:15
 * To change this template use File | Settings | File Templates.
 */
class Default {
    public static MinValidator Min(Seg n,Object minValue,String message) {
        MinValidator valid = new MinValidator(minValue,message);
        return valid;
    }

    public static MinValidator Min(Seg n,Object minValue) {
        MinValidator valid = new MinValidator(minValue,"必须大于等于{min}");
        return valid;
    }

    public static MaxValidator Max(Seg n,Object maxValue,String message) {
        MaxValidator valid = new MaxValidator(maxValue,message);
        return valid;
    }
    public static MaxValidator Max(Seg n,Object maxValue) {
        MaxValidator valid = new MaxValidator(maxValue,"必须小于等于{max}");
        return valid;
    }

    public static SizeValidator Size(Seg n,int min,int max ,String message) {
        SizeValidator valid = new SizeValidator(min,max,message);
        return valid;
    }

    public static SizeValidator Size(Seg n,int min,int max ) {
        SizeValidator valid = new SizeValidator(min,max,"必须包含{min}~{max}个字符");
        return valid;
    }

    public static PatternValidator Pattern(Seg n,String patternStr ,String message) {
        PatternValidator valid = new PatternValidator(patternStr,message);
        return valid;
    }

    public static PatternValidator Pattern(Seg n,String patternStr) {
        PatternValidator valid = new PatternValidator(patternStr,"格式不正确");
        return valid;
    }

    public static PastValidator Past(Seg n,String message) {
        PastValidator valid = new PastValidator(message);
        return valid;
    }

    public static PastValidator Past(Seg n) {
        PastValidator valid = new PastValidator("必须是过去的时间");
        return valid;
    }
    public static FutureValidator Future(Seg n,String message) {
        FutureValidator valid = new FutureValidator(message);
        return valid;
    }

    public static FutureValidator Future(Seg n) {
        FutureValidator valid = new FutureValidator("必须是将来的时间");
        return valid;
    }

    public static DigitsValidator Digits(Seg n,String message) {
        DigitsValidator valid = new DigitsValidator(message);
        return valid;
    }

    public static DigitsValidator Digits(Seg n) {
        DigitsValidator valid = new DigitsValidator("必须是数值");
        return valid;
    }

    public static UrlValidator Url(Seg n,String message){
        UrlValidator valid = new UrlValidator(message);
        return valid;
    }

    public static UrlValidator Url(Seg n){
        UrlValidator valid = new UrlValidator("必须是URL");
        return valid;
    }

    public static UrlValidator Url(Seg n,String protocol,String message){
        UrlValidator valid = new UrlValidator(protocol,message);
        return valid;
    }

    public static UrlValidator Url(Seg n,String protocol,String host,int port,String message){
        UrlValidator valid = new UrlValidator(protocol,host,port,message);
        return valid;
    }
    public static EmailValidator Email(Seg n,String message){
        EmailValidator valid = new EmailValidator(message);
        return valid;
    }
    public static EmailValidator Email(Seg n){
        EmailValidator valid = new EmailValidator("不符合email的格式要求");
        return valid;
    }
    public static NotBlankValidator NotBlank(Seg n,String message){
        NotBlankValidator valid = new NotBlankValidator(message);
        return valid;
    }

    public static NotBlankValidator NotBlank(Seg n){
        NotBlankValidator valid = new NotBlankValidator("不能为空");
        return valid;
    }

    public static AllowNullValidator AllowNull(Seg n){
        AllowNullValidator valid = new AllowNullValidator();
        return valid;
    }
}
